//
//  RImageButton.swift
//  SLQuickReader
//
//  Created by 孙林 on 2017/8/3.
//  Copyright © 2017年 ALin. All rights reserved.
//  图片在右侧的button

import UIKit
import Kingfisher

class RImageButton: UIButton {

    override func layoutSubviews() {
        super.layoutSubviews()
        
        // 没有图片就不用继续了
        guard let _ = imageView?.image else {
            return
        }
        
        guard let _ = titleLabel?.text else {
            return
        }
        
        
        if imageView!.x < titleLabel!.x {
            let imgx = imageView!.x
            titleLabel!.x = imgx
            imageView!.x = titleLabel!.frame.maxX + 4
        }
    }

}
